﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Utils;
using System.Windows.Forms;

namespace SolutionFramework.Tests
{
    public class TestBase
    {
        private string programOutput;

        protected void WriteLine(string output, params object[] args)
        {
            OutColor(ConsoleColor.Black, output, args);
        }

        protected void WriteLineRed(string output, params object[] args)
        {
            OutColor(ConsoleColor.Red, output, args);
        }

        protected void WriteLineBlue(string output, params object[] args)
        {
            OutColor(ConsoleColor.Cyan, output, args);
        }

        protected void WriteLineGreen(string output, params object[] args)
        {
            OutColor(ConsoleColor.Green, output, args);
        }

        protected void WriteLineYellow(string output, params object[] args)
        {
            OutColor(ConsoleColor.DarkYellow, output, args);
        }

        protected void OutColor(ConsoleColor color, string output, params object[] args)
        {
            using (var colorizer = new ConsoleColorizer(color))
            {
                var indentedOut = output;

                programOutput += indentedOut + "\r\n";

                Console.WriteLine(indentedOut, args);
            }
        }

        protected void FileOut(string output, params object[] args)
        {
            var indentedOut = output;

            programOutput += "\r\n" + indentedOut + "\r\n\r\n";
        }

        protected void WriteLineIndent(ref int indent, string output)
        {
            var indentedOut = new string('\t', indent) + output;

            programOutput += indentedOut + "\r\n";

            Console.WriteLine(indentedOut);
        }
    }
}
